package com.bindatax.core.task.segment;

public enum SegmentStatus {
    UNKNOWN(-1,"未知"),
    NON_EXECUTION(0,"未执行"),
    INIT(1,"初始化"),
    READY(2,"准备开始"),
    EXECUTION(3,"执行中"),
    FINISH(4,"执行完成"),
    ;
    SegmentStatus(int code,String name){
        this.code = code;
        this.name = name;
    }
    private int code;
    private String name;

    public boolean isNonExecution(){
        return this == NON_EXECUTION;
    }
    public boolean isInit(){
        return this == INIT;
    }
    public boolean isReady(){
        return this == READY;
    }
    public boolean isExecution(){
        return this == EXECUTION;
    }
    public boolean isFinish(){
        return this == FINISH;
    }

    public boolean canWriteData(){
        return this != UNKNOWN && this != FINISH;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
